home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 12 / Cream of the Crop 12 (Part II) / Cream of the Crop 12 (Part II).iso / OS2 / VD08SMP.ZIP / usr / samples / simple / simple_c.c next >
Encoding:
C/C++ Source or Header  |  1996-02-13  |  1.3 KB  |  53 lines

  1. #define INCL_PM
  2. #include <os2.h>
  3.  
  4. #define NEWCLASSNAME "NewClass"
  5.  
  6. MRESULT EXPENTRY windowFunction (HWND hwnd,ULONG msg,
  7.                                  MPARAM mp1,MPARAM mp2)
  8. {
  9.   switch (msg) {
  10.   case WM_ERASEBACKGROUND:
  11.     return (MRESULT) FALSE;
  12.   default:
  13.     return WinDefWindowProc (hwnd,msg,mp1,mp2);
  14.   }
  15. }
  16.  
  17. main ()
  18. {
  19.   HAB   hab;
  20.   HMQ   hmq;
  21.   QMSG  qmsg;
  22.   HWND  mainWindow;
  23.   HWND  clientWindow;
  24.   ULONG createFlags;
  25.  
  26.   hab = WinInitialize (0);
  27.   hmq = WinCreateMsgQueue (hab,0);
  28.  
  29.   WinRegisterClass (hab,NEWCLASSNAME,windowFunction,0L,0);
  30.  
  31.   createFlags = FCF_SYSMENU | FCF_TITLEBAR | FCF_MINMAX |
  32.                 FCF_SIZEBORDER | FCF_SHELLPOSITION | 
  33.                 FCF_TASKLIST;
  34.  
  35.   mainWindow = WinCreateStdWindow (HWND_DESKTOP,
  36.                                    WS_VISIBLE,
  37.                                    &createFlags,
  38.                                    (PSZ) NEWCLASSNAME,
  39.                                    (PSZ) "",
  40.                                    0L,
  41.                                    NULLHANDLE,
  42.                                    1000,
  43.                                    &clientWindow);
  44.  
  45.   while (WinGetMsg (hab,&qmsg,(HWND) NULL,0,0))
  46.     WinDispatchMsg (hab,&qmsg);
  47.  
  48.   WinDestroyWindow (mainWindow);
  49.  
  50.   WinDestroyMsgQueue (hmq);
  51.   WinTerminate (hab);
  52. }
  53.